<?php

use \app\assets\AppAsset;

/* @var $this yii\web\View */
/* @var $model app\models\tableModel\AdminUserModel */
/* @var $form yii\widgets\ActiveForm */

AppAsset::addCss($this, '/css/page/admin-user-form.css');
?>

<el-container class="wp-form-container">
    <el-main class="">
        <el-form :model="form" :rules="formRules" ref="ruleForm" label-width="140px"
                 class="form-600">

            <el-form-item label="账号" prop="user_name" class="has-warning-form"
                          :error="customErrMsg.user_name">

                <el-input v-model="form.user_name" size="small"
                          class="has-warning-input">
                </el-input>

            </el-form-item>

            <el-form-item label="密码" prop="password" class="has-warning-form"
                          :error="customErrMsg.password">

                <el-input v-model="form.password" size="small"
                          class="has-warning-input">
                </el-input>

            </el-form-item>

            <el-form-item label="昵称" prop="nick_name" class="has-warning-form"
                    :error="customErrMsg.nick_name">

                <el-input v-model="form.nick_name" size="small"
                          class="has-warning-input">
                </el-input>

            </el-form-item>

            <el-form-item label="状态" prop="status" class="has-warning-form"
                    :error="customErrMsg.status">

                <el-radio-group v-model="form.status" size="mini">
                    <el-radio v-for="(item, key) in setting.statusTxt"
                        :label="parseInt(key)">
                        {{item}}
                    </el-radio>
                </el-radio-group>

            </el-form-item>

            <el-form-item label="角色" prop="role_id" class="has-warning-form"
                    :error="customErrMsg.role_id">

                <el-select v-model="form.role_id" placeholder="请选择" size="small">
                    <el-option
                            v-for="item in roleList" :key="item.id" :label="item.name"
                            :value="item.id">
                    </el-option>
                </el-select>

            </el-form-item>

        </el-form>
    </el-main>

    <el-footer class="bottom-button" :height="50">
        <el-button size="mini" type="primary" @click="submitAdd" v-if="setting.isAdd === true">
            创建
        </el-button>
        <el-button size="mini" type="primary" @click="submitUpdate" v-if="setting.isAdd === false">
            保存
        </el-button>
        <el-button size="mini" @click="cancel">取消</el-button>
    </el-footer>
</el-container>

<?= AppAsset::addScript($this, '/js/page/admin-user-form.js'); ?>
<?= $this->registerJs('
    new app();
'); ?>
